<template>
    <div id="order_table">
        <el-table
            :data="orderList"
            stripe
            style="width: 100%">
            <el-table-column
            prop="id"
            label="订单编号"
            width="180">
            </el-table-column>
            <el-table-column
            prop="orderTime"
            label="下单时间"
            width="180">
            </el-table-column>
            <el-table-column
            prop="total"
            label="总价"
            width="180">
            </el-table-column>
            <el-table-column
            prop="status"
            label="状态"
            width="180">
            </el-table-column>
            <el-table-column
            prop="customerId"
            label="顾客id"
            width="180">
            </el-table-column>
            <el-table-column
            label="操作">
                <span>详情</span>
            </el-table-column>
        </el-table>
    </div>
</template>
<script>
    import qs from 'querystring'
    export default{
        data(){
            return {
                orders:[],
            }
        },
        computed:{
            orderList(){
                this.orders.forEach((item)=>{
                    item.orderTime=new Date(item.orderTime).toLocaleDateString();
                })
                return this.orders
            }
        },
        methods:{
            sendItem(name){
                //alert(name);->status
                if(name=='所有订单'){
                    var data={
                        page:1,
                        pageSize:10
                    }
                }else{
                    var data={
                        page:1,
                        pageSize:10,
                        status:name
                    }
                }
                 
                this.$axios.post("/order/queryPage",qs.stringify(data)).then(response=>{
                    console.log(response);
                    this.orders=response.data.data.list;
                });
            }
        }
    }

</script>